using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Windows.Forms;
using System.Collections;
using System.ComponentModel;

namespace LowLevelGraphics
{
    /// <summary>
    /// This is the convolution matrix a classical matrix for imaging calculations like
    /// x1 x2 x3
    /// x4 x5 x6
    /// x7 x8 x9 / x10 + x11
    /// </summary>
    public class CConvMatrix
    {
        public int TopLeft = 0, TopMid = 0, TopRight = 0;
        public int MidLeft = 0, Pixel = 1, MidRight = 0;
        public int BottomLeft = 0, BottomMid = 0, BottomRight = 0;
        public int Factor = 1;
        public int Offset = 0;

        /// <summary>
        /// Default Constructor
        /// </summary>
        public CConvMatrix()
        {
        }

        /// <summary>
        /// Set all Values to
        /// </summary>
        /// <param name="_nSetAllValuesTo"></param>
        public CConvMatrix(int _nSetAllValuesTo)
        {
            SetAll(_nSetAllValuesTo);
        }

        /// <summary>
        /// Sets all.
        /// </summary>
        /// <param name="nVal">The n val.</param>
        public void SetAll(int nVal)
        {
            TopLeft = TopMid = TopRight = MidLeft = Pixel = MidRight = BottomLeft = BottomMid = BottomRight = nVal;
        }

        /// <summary>
        /// Gets the kernel.
        /// </summary>
        /// <value>The kernel.</value>
        public int[] Kernel
        {
            get
            { 
                return new int[] { 
                    TopLeft, TopMid, TopRight, 
                    MidLeft, 0, MidRight, 
                    BottomLeft, BottomMid, BottomRight 
                };
            }
        }
    }
}
